home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #14 / Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO / math / maca_101.zip / ROOTS.DEM < prev   
Text File  |  1996-01-30  |  2KB  |  54 lines

  1. ;ROOTS.DEM
  2. ;DEMO FILE FOR MASSCALC VERSION 1.00
  3. ;WRITTEN BY: Ralph W. Reid
  4. ;This file may only be distributed in its unmodified form.
  5. ;
  6. ;DESCRIPTION:  This file primarily demonstrates root calculations.
  7. ;
  8. ;For the latest releases of MASSCALC and other software created by
  9. ;Ralph W. Reid, see http://www2.athenon.com/~rreid/products/00-index.html.
  10. ;
  11. ;HOW TO USE THIS FILE:  This file may be piped into MASSCALC, and its
  12. ;output displayed as follows:
  13. ;TYPE ROOTS.DEM | MASSCALC | MORE
  14. ;This file may be redirected into MASSCALC and its output displayed
  15. ;as follows:
  16. ;MASSCALC < ROOTS.DEM | MORE
  17. ;These two commands should be run from the operating system prompt.
  18.  
  19. ;show values of important predefined variables
  20. _scale;
  21. print: "function tolerance set =" _tolerance
  22.  
  23. ;use a root function to find the constant value sqrt (2)
  24. print: "Finding sqrt (2) with a root function:"
  25. ;parameters are: variable name, starting point, function, derivative
  26. root_newton (x, 0, x - sqrt (2), 1);
  27.  
  28. ;find the intersection of the equations:
  29. ;  x ^ 2 - 2
  30. ;  x
  31. print:
  32. print: "Finding the x and y intersection coordinates of (x^2 - 2) and (x):"
  33. ;parameters are variable name, low value, high value, function
  34. x = root_secant (x, 0.1, 1e4, (x^2 - 2) - (x));
  35. print: "x =" x
  36. print: "y =" x^2 - 2
  37.  
  38. ;finds one of the roots of x^2 - 1
  39. print:
  40. print: "Finding one of the roots of x^2 - 1:"
  41. ;parameters are variable name, starting point, step value, and function
  42. root_muller (x, 0, 0.001, x^2-1);
  43.  
  44. ;finds the x value when y = 3
  45. print:
  46. print: "Finds the value of EXP (x) where y = 3:"
  47. print: "Values are shown as calculations are performed."
  48. _out_iterations = 1;     turns on interative output
  49. ;parameters are variable name, low value, high value, function
  50. root_inthalf (x, 1, 500, exp (x) - 3);
  51. print: "Function tolerance was set =" _tolerance ", so the last few digits"
  52. print: "may not be significant."
  53.  
  54.